﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Krist_em_up.Characters;
using Microsoft.Xna.Framework;
using Krist_em_up.Item.Projectiles;

namespace Krist_em_up.Item.Weapons
{
    class Gun : Weapon
    {
        public Gun(int owner, Kristemup k)
        {
            this.owner = owner;
            this.ammunition = -1;
            this.Name = "Simple Gun";
            this.game = k;
            this.reloadTimer = new TimeSpan(0, 0, 0, 0, 300);
        }
        //public new int Ammunition
        //{
        //    get { return ammunition; }
        //}
        /// <summary>
        /// Pull the trigger nigga!
        /// </summary>
        /// <param name="position">Position where the weapon shoot</param>
        /// <param name="direction">True for right, false for left</param>
        public override void Shoot(Vector2 position, bool direction)
        {
            if (reloadTimer <= TimeSpan.Zero)
            {
                GunBullet balle;
                if (direction)
                    balle = new GunBullet(owner, game, new Vector2(position.X + Kris.WIDTH, position.Y + Kris.HEIGHT / 2 + 10), new Vector2(1, 0));
                else
                    balle = new GunBullet(owner, game, new Vector2(position.X, position.Y + Kris.HEIGHT / 2 + 10), new Vector2(-1, 0));
                game.bullets.Add(balle);
                this.reloadTimer = new TimeSpan(0, 0, 0, 0, 300);
            }
        }
    }
}
